package com.xyzwps.example.moment;

import java.util.Date;
import java.util.Objects;

public class Moment {

    private final Date date;

    private final ParsedPattern pattern;

    private Moment(Date date, ParsedPattern pattern) {
        this.date = Objects.requireNonNull(date);
        this.pattern = Objects.requireNonNull(pattern);
    }

    public static Moment moment(Date date, String pattern) {
        return new Moment(date, PatternParser.parsePattern(pattern));
    }
}
